#include "md5.h" 
static void printf_hexstream(unsigned char *pData, int len, const char* strTag)
{
	int i;
	char buff[1024 + 2] = { 0 };
	int ret = 0;
	int pos = 0;
	for (i = 0; i<len&&i<512; i++)
	{
		ret = sprintf(buff + pos, "%0.2X", pData[i]);
		pos += ret;
	}
	if (strTag)
	{
		printf("\r\n%s %s\r\n", strTag, buff);
	}
	else
	{
		printf("\r\n%s\r\n", buff);
	}
	// printf("\r\n%s:%s\r\n",strTag,buff);
}
 
 
 
extern int CalcFileMD5(const char* filename, unsigned char md5[16]);
 
void testFileMD5()
{
	int rslt;
	unsigned char md5[16] = { 0 };
 
	printf("\r\n--------test file MD5-----------\r\n");
	rslt = CalcFileMD5("HexEditor.dll",md5);
	if (rslt == 0)
	{
		printf_hexstream(md5, sizeof(md5), 0);
	}
	else
	{
		printf("\r\nfailed to call CalcFileMD5()");
	}
}
 
 
 
int main(int argc, char *argv[])
{
	testFileMD5();
 
	printf("\r\n");
 
	system("PAUSE");
	return 0;
}
